# Figure B1

#####
rm(list=ls(all=TRUE))

library(ggplot2)
library(ggpubr)

#### Dataset Original ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_count_rep.Rdata")

#### Datasets Threshold ----
load("data_empirics_count_0.Rdata") 
load("data_empirics_count_50.Rdata") 
load("data_empirics_count_100.Rdata") 
load("data_empirics_count_200.Rdata") 

#### FIGURE B1: Histogram Thres ####

speeches_hist_0 <- ggplot(data_empirics_count_0, aes(tot_speeches_leg_cohort, fill = female_dum)) +
  geom_density(alpha = 0.5) + 
  xlab("Number of Speeches") + ylab("Density") +
  labs(title = "0-words Minimum Threshold") +
  ylim(c(0,0.025)) + xlim(c(0,1000)) +
  # coord_cartesian(xlim=c(0.9,2)) + 
  theme(legend.position="bottom") 

speeches_hist_20 <- ggplot(data_empirics_count, aes(tot_speeches_leg_cohort, fill = female_dum)) +
  geom_density(alpha = 0.5) + 
  xlab("Number of Speeches") + ylab("Density") +
  labs(title = "Original Threshold") +
  ylim(c(0,0.025)) + xlim(c(0,1000)) +
  # coord_cartesian(xlim=c(0.9,2)) + 
  theme(legend.position="bottom") 

speeches_hist_50 <- ggplot(data_empirics_count_50, aes(tot_speeches_leg_cohort, fill = female_dum)) +
  geom_density(alpha = 0.5) + 
  xlab("Number of Speeches") + ylab("Density") +
  labs(title = "50-words Minimum Threshold") +
  ylim(c(0,0.025)) + xlim(c(0,1000)) +
  # coord_cartesian(xlim=c(0.9,2)) + 
  theme(legend.position="bottom") 

speeches_hist_100 <- ggplot(data_empirics_count_100, aes(tot_speeches_leg_cohort, fill = female_dum)) +
  geom_density(alpha = 0.5) + 
  xlab("Number of Speeches") + ylab("Density") +
  labs(title = "100-words Minimum Threshold") +
  ylim(c(0,0.025)) + xlim(c(0,1000)) +
  # coord_cartesian(xlim=c(0.9,2)) + 
  theme(legend.position="bottom") 

speeches_hist_200 <- ggplot(data_empirics_count_200, aes(tot_speeches_leg_cohort, fill = female_dum)) +
  geom_density(alpha = 0.5) + 
  xlab("Number of Speeches") + ylab("Density") + 
  labs(title = "200-words Minimum Threshold") +
  ylim(c(0,0.025)) + xlim(c(0,1000)) +
  # coord_cartesian(xlim=c(0.9,2)) + 
  theme(legend.position="bottom") 

### All together now:

combined_speeches <- ggarrange(speeches_hist_20, speeches_hist_0,
                               speeches_hist_50,speeches_hist_100,
                               speeches_hist_200,
                               ncol = 3, nrow = 2,common.legend = T,
                               legend = "bottom")

combined_speeches

setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Figures")
ggsave("figureB1.pdf", width = 15, height = 12)



